package com.zzedu.common.enums;

import java.util.Arrays;

/**
 * 登录账号 类型
 */
public enum LoginType {
    PWD(0, "密码", null),
    SMS_CODE(1, "短信验证码", "smsCodePasswordService"),

    NO_CHECK_WX(3, "微信openId", "noCheck"),

            ;

    private final int code;
    private final String desc;

    /**
     * 密码验证起
     */
    private final String checkValidator;


    LoginType(int code, String desc, String checkValidator) {
        this.code = code;
        this.desc = desc;
        this.checkValidator = checkValidator;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getCheckValidator() {
        return checkValidator;
    }
    public static LoginType getCode(int code) {
        return Arrays.stream(LoginType.values()).filter(e -> e.getCode() == code).findFirst().orElse(null);
    }
}
